{template 'common/header'}

<div class='container' style='padding:0 5px 10px;margin:0;width:100%'>
	<ul class="nav nav-tabs">
	  <li {if $op == 'post'}class="active"{/if}><a href="{php echo $this->createWebUrl('slide', array('op' => 'post'));}">添加幻灯片</a></li>
	  <li {if $op == 'display'}class="active"{/if}><a href="{php echo $this->createWebUrl('slide',array('op'=>'display'));}">管理幻灯片</a></li>
	  <li><a href="{php echo $this->createWebUrl('adv');}">管理广告</a></li>
	</ul>
	{if $op =='display'}
		<div class="panel panel-success">
		  <div class="panel-heading">常用工具 > 幻灯片列表</div>
		</div>
		<form id="form2" class="form-horizontal" method="post">
			<table class="table table-hover" style="table-layout:fixed;">
				<thead class="navbar-inner">
					<tr>
						<th style="width:70px;">全选</th>
	          			<th style="width:110px;text-align: center;">幻灯片标题</th>
	          			<th style="width:240px;text-align: center;">幻灯片图片</th>
	          			<th style="width:220px;text-align: center;">幻灯片链接</th>
	          			<th style="width:100px;text-align: center;">序号</th>
						<th style="min-width:100px;width:100px;text-align: center;">编辑</th>
					</tr>
				</thead>
				<tbody>
					{loop $list $item}
					<tr>
						<td><input type="checkbox" value="{$item['slide_id']}" name="delete[]"></td>
						<td style="text-align: center;">{$item['slide_title']}</td>
						<td style="text-align: center;"><img src="{$_W['attachurl']}{$item['slide_pic']}" style="width:100px"></td>
						<td style="text-align: center;word-wrap:break-word;">{$item['slide_url']}</td>
						<td style="text-align: center;">{$item['xh']}</td>
						<td style="text-align: center;word-wrap:break-word;">
						<a href="{php echo $this->createWebUrl('slide', array('op' => 'post', 'slide_id' => $item['slide_id']))}" title="编辑" class="btn btn-xs btn-primary"><span class="icon icon-compose">编辑</span></a>						
						<a onclick="if(confirm('此操作不可恢复，确认吗？')){location.href='{php echo $this->createWebUrl('slide', array('slide_id' => $item['slide_id'],'op'=>'del'))}'}" href="javascript:;" title="删除" class="btn btn-xs btn-danger"><span class="icon icon-close">删除</span></a>
						</td>				
					</tr>
					{/loop}
					<tr >
						<td><input type="checkbox"  onclick="var ck = this.checked;$(':checkbox').each(function(){this.checked = ck});" name=''>
							<input class="btn btn-primary btn-xs" type="submit" value="删除" name="submit" >
						</td>
						<td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td>
					</tr>
				</tbody>
			</table>
			<input type="hidden" value="slide" name="do">
			<input type="hidden" value="del" name="op">
			<input type="hidden" name="token" value="{$_W['token']}" />
		</form>
		{$pager}
		
		<script>
			$('#form2').submit(function(){
				if($(":checkbox[name='delete[]']:checked").size() > 0){
					return confirm('删除后不可恢复，您确定删除吗？');
				}
				return false;
			}); 
		</script>	
	</div>
	{elseif $op == 'post'}
	<div class="panel panel-success">
	    <div class="panel-heading">常用工具 > 添加/修改幻灯片</div>
	</div>
	<div class="main">
		<form action="" method="post" class="form-horizontal form">
			<div class="panel panel-default">	
				<div class="panel-body">
					<div class="form-group">
						<label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">幻灯片标题</label>
						<div class="col-sm-6">
							<input type="text" name="slide_title" class="form-control" value="{$item['slide_title']}" />
							<span class="help-block"></span>
						</div>
					</div>	
					<div class="form-group">
						<label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">序号</label>
						<div class="col-sm-6">
							<input type="text" name="xh" class="form-control" value="{$item['xh']}" />
							<span class="help-block">请填写整数</span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">幻灯片图片</label>
						<div class="col-sm-6">
							{php echo tpl_form_field_image('slide_pic',$item['slide_pic']);}
							<span class="help-block">建议尺寸：420*210</span>
						</div>
					</div>	
					<div class="form-group">
						<label class="col-xs-12 col-sm-4 col-md-2 col-lg-2 control-label">幻灯片链接</label>
						<div class="col-sm-6">
							<input type="text" name="slide_url" class="form-control" value="{$item['slide_url']}" />
							<span class="help-block"></span>
						</div>
					</div>	
					
					<div class="form-group">
						<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label"></label>
						<div class="col-sm-4">
							<input type="hidden" name="slide_id" value="{$item[slide_id]}">
							<input type="hidden" name="token" value="{$_W['token']}" />
							<input name="submit" type="submit" value="提交" class="btn btn-primary span4" />
						</div>
					</div>	
				</div>
			</div>
		</form>
	</div>
{/if}		
</div>

{template 'common/footer'}
